window.onload = function(){
    document.addEventListener('scroll', function () {
        var nav = document.querySelector('nav')
        var firstbg = document.querySelector('.first-bg')
        // window.pageYOffset 被卷去的头部距离
        if (window.pageYOffset > 0) {
            // 但被卷去头部距离大于等于170时 侧边栏改为固定定位
            nav.style.position = 'fixed';
            // nav.style.top = 0 + 'px';
        }
        else {
            nav.style.position = 'none';
            // sliderber.style.top = '50%'
        }
    })
}